import { useEffect } from 'react';
import { IRouteComponentProps ,PageModelState,useDispatch ,useSelector ,ArticleModelState} from "umi";
const map:{[key:string]:string} ={
  'msgboard':'2c1794cc-10d8-4d48-adda-7ff02371aee8',
  'about':'8f3973e9-4ed4-4849-ad85-b7d3b8093623'
}
const Page:React.FC<IRouteComponentProps<{id:string}>> =({match})=>{

    const path = match.params.id;
    const id = map[path]
    const dispatch = useDispatch();
    const {pageItem } = useSelector((state:{page:PageModelState})=>state.page)
    useEffect(()=>{

        dispatch({
            type:'page/getPageView',
            payload:id
        })
    },[])
    return <div>
        <div dangerouslySetInnerHTML={{__html:pageItem.content}}></div>
    </div>
}
export default Page;